//
//  MSSearchProjectTableVC.m
//  SocietySale
//
//  Created by Mike on 16/11/17.
//  Copyright © 2016年 Mike. All rights reserved.
//

#import "MSSearchProjectTableVC.h"
#import "MSHomeCell.h"
#import "MSSetTableViewCell.h"

@interface MSSearchProjectTableVC ()

@end

@implementation MSSearchProjectTableVC

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (_haveData) {
        static NSString *identifier = @"customerCell";
        MSHomeCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
        if (cell==nil) {
            cell = [[MSHomeCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
            cell.introductionLabel.hidden = YES;
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
        }
        cell.model = self.dataArray[indexPath.row];
        return cell;
    }
    else{
        NSString *cellId = @"cellId";
        MSSetTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
        if (!cell) {
            cell = [[MSSetTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellId];
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
        }
        cell.horizonLineView.hidden = YES;
        cell.data = self.dataArray[indexPath.row];
        return cell;
    }
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (_haveData)
    {
        return 75;//[MSHomeCell cellHeightWithModel:self.dataArray[indexPath.row]];
    }
    else{
        return 40;
    }
}

- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{
    if ([self.delegate respondsToSelector:@selector(scrollViewWillBeginDragging:)]) {
        [self.delegate performSelector:@selector(scrollViewWillBeginDragging:) withObject:self];
    }
}

@end
